﻿package mortal.game.view.mainUI.shortcutbar
{
    import Message.Public.*;
    import com.gengine.global.*;
    import flash.geom.*;
    import mortal.common.net.*;
    import mortal.common.shortcutsKey.*;
    import mortal.component.gconst.*;
    import mortal.game.events.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.scene3D.ai.singleAIs.*;
    import mortal.game.scene3D.util.*;
    import mortal.game.utils.*;
    import mortal.game.view.common.cd.*;
    import mortal.game.view.common.display.*;
    import mortal.game.view.common.guide.*;
    import mortal.game.view.common.item.*;
    import mortal.game.view.mainUI.shortcutbar.exSkill.*;
    import mortal.game.view.skill.*;
    import mortal.game.view.skill.panel.render.*;
    import mortal.game.view.systemSetting.*;
    import mortal.mvc.core.*;
    import mortal.mvc.interfaces.*;

    public class ShortcutBarController extends Controller
    {
        private var _shortcutBar:ShortcutBar;
        private var _exSkillBar:ExSkillShortcutBar;
        private var _keyProcessor:ShortcutBarKeyProcessor;
        private var _lastFrameSSkill:SSkill;
        private var _msgGot:int = 0;

        public function ShortcutBarController()
        {
            this._keyProcessor = new ShortcutBarKeyProcessor();
            return;
        }// end function

        override protected function initView() : IView
        {
            if (this._shortcutBar == null)
            {
                this._shortcutBar = new ShortcutBar();
            }
            return this._shortcutBar;
        }// end function

        override protected function initServer() : void
        {
            NetDispatcher.addCmdListener(ServerCommand.ShortcutBarDataUpdate, this.shortcutDataUpdateHandler);
            Dispatcher.addEventListener(EventName.NavbarButtonUIRowInited, this.uiRowInitedHandler);
            NetDispatcher.addCmdListener(ServerCommand.ExSkillShortcutBarDataUpdate, this.onExSkillShortcutBarDataUpdate);
            NetDispatcher.addCmdListener(ServerCommand.SkillUpgrade, this.skillUpgradeHandler);
            NetDispatcher.addCmdListener(ServerCommand.SkillAdd, this.skillAddHandler);
            Dispatcher.addEventListener(EventName.AutoGuideAddSkillShortcut, this.customAddSkillShortCutHandler);
            Dispatcher.addEventListener("AutoGuideAddXPSkillShortCut", this.addXPShortCutHandler);
            NetDispatcher.addCmdListener(ServerCommand.BackPackItemsChange, this.itemNumChangedHandler);
            NetDispatcher.addCmdListener(ServerCommand.BufferUpdate, this.buffUpdateHandler);
            NetDispatcher.addCmdListener(ServerCommand.AngerUpdate, this.updateAnger);
            NetDispatcher.addCmdListener("buff_" + EBuffType._EBuffTypeIncOrDeAngerMax, this.updateAnger);
            NetDispatcher.addCmdListener(ServerCommand.WizardSelectSuccess, this.updateSelected);
            NetDispatcher.addCmdListener(ServerCommand.ExpUpdate, this.updateExp);
            NetDispatcher.addCmdListener(ServerCommand.RoleLevelUpdate, this.updateExpBgLevel);
            NetDispatcher.addCmdListener(ServerCommand.WorldLevelUpdate, this.updateWorldLevel);
            Dispatcher.addEventListener(EventName.StageResize, this.stageResizeHandler);
            Dispatcher.addEventListener(EventName.ShortcutKeyUpdate, this.shorcutKeyUpdateHandler);
            Dispatcher.addEventListener(EventName.ShortcutBarDataChange, this.shortcutBarDataChangeHandler);
            Dispatcher.addEventListener(EventName.ShortExCutBarDataChange, this.onShortExCutBarDataChange);
            Dispatcher.addEventListener(EventName.ShortcutBarMoveIn, this.moveInHandler);
            Dispatcher.addEventListener(EventName.ShortcutBarThrow, this.throwHandler);
            Dispatcher.addEventListener(EventName.ExShortcutBarMoveIn, this.exShortcutBarMoveIn);
            Dispatcher.addEventListener(EventName.ShortcutBarKeyDown, this.keyDownHandler);
            Dispatcher.addEventListener(EventName.ShortcutBarClicked, this.clickHandler);
            Dispatcher.addEventListener(EventName.ShortcutBarKeyUp, this.keyUpHandler);
            Dispatcher.addEventListener(EventName.TabKeyChangeTarget, this.tabKeyChangeTargetHandler);
            Dispatcher.addEventListener(EventName.SystemSettingSaved, this.settingSavedHandler);
            NetDispatcher.addCmdListener(ServerCommand.SystemSettingDataGot, this.systemSettingGotHandler);
            Dispatcher.addEventListener(EventName.ShortcutBarShowHide, this.showHideModuleHandler);
            NetDispatcher.addCmdListener(ServerCommand.SkillExListUpdate, this.skillExListHandler);
            Dispatcher.addEventListener(EventName.StartDragDragables, this.dragDragblesHandler);
            Dispatcher.addEventListener(EventName.StopDragDragables, this.stopDragblesHandler);
            Dispatcher.addEventListener(EventName.AutoGuideActiveByEvent, this.spriteUpdate);
            Dispatcher.addEventListener(EventName.RoleCareerChanged, this.roleCareerChangedHandler);
            return;
        }// end function

        private function roleCareerChangedHandler(param1) : void
        {
            cache.shortcut.checkAndSaveToCurCareerSkill();
            if (AutoGuideController.isUIRowIninted)
            {
                this.checkAndShowShortcutBarIcon();
            }
            return;
        }// end function

        private function dragDragblesHandler(event:DataEvent) : void
        {
            if (this._shortcutBar != null && this._shortcutBar.parent != null)
            {
                this._shortcutBar.updateItemsShow(true, true);
            }
            return;
        }// end function

        private function stopDragblesHandler(event:DataEvent) : void
        {
            CallLater.addCallBack(this.stopDragblesNextFrame);
            return;
        }// end function

        private function stopDragblesNextFrame() : void
        {
            if (this._shortcutBar != null && this._shortcutBar.parent != null)
            {
                this._shortcutBar.updateItemsShow(false, true);
            }
            return;
        }// end function

        private function skillExListHandler(param1:Object) : void
        {
            var _loc_4:SkillInfo = null;
            var _loc_5:Array = null;
            cache.skill.isShowingExSkill = true;
            if (this._shortcutBar != null && this._shortcutBar.parent != null)
            {
                this._shortcutBar.hide();
            }
            if (this._exSkillBar == null)
            {
                this._exSkillBar = new ExSkillShortcutBar();
            }
            var _loc_2:* = param1 ? (int(param1)) : (8);
            this._exSkillBar.setParams(_loc_2, 42, 42);
            this._exSkillBar.show();
            var _loc_3:* = cache.skill.getExSkillList();
            for each (_loc_4 in _loc_3)
            {
                
                this._exSkillBar.updateShortcutSource(_loc_4.tSkill.posType, _loc_4);
            }
            _loc_5 = ShortcutsKey.instance.moduleAry.concat(ShortcutsKey.instance.skillsAry);
            this._exSkillBar.updateShortcutKey(_loc_5);
            return;
        }// end function

        private function showHideModuleHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as Boolean;
            if (this._shortcutBar == null)
            {
                return;
            }
            if (_loc_2)
            {
                this._shortcutBar.show();
                if (this._exSkillBar && this._exSkillBar.parent)
                {
                    cache.skill.isShowingExSkill = false;
                    this._exSkillBar.hide();
                }
            }
            else
            {
                this._shortcutBar.hide();
            }
            return;
        }// end function

        private function systemSettingGotHandler(param1:Object) : void
        {
            if (this._shortcutBar != null)
            {
                this.updateLockStatus();
                this.updateShowCDTime();
            }
            return;
        }// end function

        private function settingSavedHandler(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data["type"]);
            if (_loc_2 != SystemSettingType.SystemSetting)
            {
                return;
            }
            this.updateLockStatus();
            this.updateShowCDTime();
            return;
        }// end function

        private function updateLockStatus() : void
        {
            var _loc_1:* = SystemSetting.instance.isLockShortcut.bValue;
            var _loc_2:* = cache.shortcut.isLocked;
            if (_loc_1 == _loc_2)
            {
                return;
            }
            cache.shortcut.isLocked = _loc_1;
            this._shortcutBar.updateLockStatus(_loc_1);
            return;
        }// end function

        private function updateShowCDTime() : void
        {
            var _loc_5:ShortcutBarItem = null;
            var _loc_1:* = SystemSetting.instance.isShortcutShowSecond.bValue;
            var _loc_2:* = cache.shortcut.isShowCDTime;
            if (_loc_1 == _loc_2)
            {
                return;
            }
            cache.shortcut.isShowCDTime = _loc_1;
            var _loc_3:* = this._shortcutBar.getAllItems();
            var _loc_4:int = 0;
            while (_loc_4 < _loc_3.length)
            {
                
                _loc_5 = _loc_3[_loc_4];
                if (_loc_5 == null)
                {
                }
                else
                {
                    _loc_5.isShowLeftTimeEffect = _loc_1;
                }
                _loc_4++;
            }
            return;
        }// end function

        private function buffUpdateHandler(param1:Object) : void
        {
            var _loc_4:ShortcutBarItem = null;
            var _loc_5:SkillInfo = null;
            var _loc_2:* = this._shortcutBar.getAllItems();
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3];
                if (_loc_4 == null)
                {
                }
                else
                {
                    _loc_5 = _loc_4.dragSource as SkillInfo;
                    if (_loc_5 == null)
                    {
                    }
                    else if (!BuffUtil.isCanRoleFireSkill(_loc_5))
                    {
                        _loc_4.mouseChildren = false;
                        _loc_4.mouseEnabled = false;
                        _loc_4.filters = [FilterConst.colorFilter];
                    }
                    else
                    {
                        _loc_4.mouseChildren = true;
                        _loc_4.mouseEnabled = true;
                        _loc_4.filters = [];
                    }
                }
                _loc_3++;
            }
            return;
        }// end function

        private function itemNumChangedHandler(param1:Object) : void
        {
            var _loc_4:ShortcutBarItem = null;
            var _loc_2:* = this._shortcutBar.getAllItems();
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3];
                if (_loc_4 == null || _loc_4.dragSource == null)
                {
                }
                else
                {
                    _loc_4.updateNum();
                }
                _loc_3++;
            }
            return;
        }// end function

        private function addXPShortCutHandler(event:DataEvent) : void
        {
            return;
        }// end function

        private function customAddSkillShortCutHandler(event:DataEvent) : void
        {
            var _loc_2:* = new SSkill();
            _loc_2.skillId = parseInt(event.data as String);
            this.skillAddHandler(_loc_2, true, true);
            return;
        }// end function

        private function skillAddHandler(param1:Object, param2:Boolean = false, param3:Boolean = false) : void
        {
            var skillId:int;
            var info:SkillInfo;
            var targetItem:ShortcutBarItem;
            var nextFrameLearnSkill:Function;
            var afterFlyTo:Function;
            var obj:* = param1;
            var isCanFromMid:* = param2;
            var isShift:* = param3;
            nextFrameLearnSkill = function () : void
            {
                var _loc_9:SkillItem = null;
                var _loc_10:Array = null;
                var _loc_11:Point = null;
                var _loc_1:* = getSkillsShortcutItem(info);
                if (_loc_1 != null)
                {
                    return;
                }
                var _loc_2:* = _shortcutBar.getAllItems();
                var _loc_3:int = 1;
                if (isShift)
                {
                    _loc_3 = 11;
                }
                var _loc_4:* = _loc_3;
                while (_loc_4 < _loc_2.length)
                {
                    
                    _loc_1 = _loc_2[_loc_4];
                    if (_loc_1 == null || _loc_1.dragSource != null)
                    {
                    }
                    else if (cache.shortcut.getData(_loc_4) != null)
                    {
                    }
                    else
                    {
                        targetItem = _loc_1;
                        break;
                    }
                    _loc_4++;
                }
                if (targetItem == null)
                {
                    return;
                }
                var _loc_5:* = cache.skill.getSkill(skillId);
                var _loc_6:* = CDDataType.parseType(_loc_5);
                var _loc_7:* = ShortcutBarUtil.parseValue(_loc_5);
                var _loc_8:* = targetItem.localToGlobal(GameConst.yellowPoint);
                if (SkillController(GameController.skill).isModuleShowing)
                {
                    _loc_9 = SkillLearnModule(GameController.skill.view).getItemByPos(info.position);
                }
                else
                {
                    if (isCanFromMid)
                    {
                        cache.shortcut.addShortCut(targetItem.pos, _loc_6, _loc_7);
                        cache.shortcut.save();
                        _loc_10 = [];
                        _loc_10[0] = _loc_5.tSkill.skillIcon + ".jpg";
                        _loc_10[1] = new Point(Global.stage.stageWidth / 2, Global.stage.stageHeight / 2);
                        _loc_10[2] = _loc_8;
                        _loc_10[3] = 0.7;
                        _loc_10[4] = 0.7;
                        _loc_10[5] = afterFlyTo;
                        Dispatcher.dispatchEvent(new DataEvent(EventName.FlyItemToAnyPoint, _loc_10));
                    }
                    return;
                }
                cache.shortcut.addShortCut(targetItem.pos, _loc_6, _loc_7);
                cache.shortcut.save();
                if (targetItem.pos >= 11)
                {
                    shortcutBar.showItem(targetItem.pos);
                }
                if (_loc_9 != null)
                {
                    _loc_11 = _loc_9.localToGlobal(GameConst.yellowPoint);
                    _loc_11.x = _loc_11.x + 28;
                    _loc_11.y = _loc_11.y + 28;
                    FlyToNavbarTool.flyToAnyPoint(_loc_9.bitmapdata, _loc_11, _loc_8, afterFlyTo, targetItem.width, targetItem.height, false, 1, 1, true, null);
                }
                return;
            }// end function
            ;
            afterFlyTo = function () : void
            {
                if (targetItem == null)
                {
                    return;
                }
                var _loc_1:* = cache.skill.getSkill(skillId);
                _shortcutBar.updateShortcutSource(targetItem.pos, _loc_1);
                _shortcutBar.showItem(targetItem.pos);
                _shortcutBar.updateItemsShow(false);
                targetItem = null;
                return;
            }// end function
            ;
            skillId = SSkill(obj).skillId;
            info = cache.skill.getSkill(skillId);
            if (info == null)
            {
                cache.skill.checkAndAddBasicSkills();
                info = cache.skill.getSkill(skillId);
                if (info == null)
                {
                    return;
                }
            }
            if (info.isBeAttackSkill)
            {
                return;
            }
            if (SkillUtil.isGuildSkill(info.tSkill))
            {
                return;
            }
            CallLater.addCallBack(nextFrameLearnSkill);
            return;
        }// end function

        private function skillUpgradeHandler(param1:Object) : void
        {
            this._lastFrameSSkill = param1 as SSkill;
            CallLater.addCallBack(this.nextFrameSkillUpgrade);
            return;
        }// end function

        private function nextFrameSkillUpgrade() : void
        {
            var _loc_1:* = this._lastFrameSSkill;
            var _loc_2:* = cache.skill.getSkill(_loc_1.skillId);
            if (_loc_2 == null)
            {
                return;
            }
            var _loc_3:* = this.getSkillsShortcutItem(_loc_2);
            if (_loc_3 != null)
            {
                _loc_3.dragSource = _loc_2;
            }
            return;
        }// end function

        public function getSkillsShortcutItem(param1:SkillInfo) : ShortcutBarItem
        {
            var _loc_4:ShortcutBarItem = null;
            var _loc_5:SkillInfo = null;
            var _loc_2:* = this._shortcutBar.getAllItems();
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2.length)
            {
                
                _loc_4 = _loc_2[_loc_3];
                if (_loc_4 && _loc_4.dragSource is SkillInfo)
                {
                    _loc_5 = _loc_4.dragSource as SkillInfo;
                    if (_loc_5.tSkill.series == param1.tSkill.series)
                    {
                        return _loc_4;
                    }
                }
                _loc_3++;
            }
            return null;
        }// end function

        private function stageResizeHandler(event:DataEvent) : void
        {
            this._shortcutBar.onStageResize();
            if (this._exSkillBar != null)
            {
                this._exSkillBar.onStageResize();
            }
            return;
        }// end function

        private function moveInHandler(event:DataEvent) : void
        {
            var _loc_9:int = 0;
            var _loc_10:Object = null;
            var _loc_11:Object = null;
            var _loc_2:* = event.data["from"];
            var _loc_3:* = event.data["to"];
            if (_loc_3 == null || _loc_2 == null)
            {
                return;
            }
            var _loc_4:* = _loc_3.pos;
            var _loc_5:* = _loc_2.dragSource;
            var _loc_6:* = _loc_3.dragSource;
            var _loc_7:* = cache.shortcut.getData(_loc_4);
            var _loc_8:* = CDDataType.skillInfo;
            if (_loc_5 is ItemData && ItemsUtil.isEquip(_loc_5 as ItemData))
            {
                return;
            }
            if (_loc_2 is ShortcutBarItem)
            {
                _loc_9 = ShortcutBarItem(_loc_2).pos;
                _loc_10 = cache.shortcut.getData(_loc_9);
                if (_loc_10 == null)
                {
                    return;
                }
                if (_loc_7 == null)
                {
                    cache.shortcut.addShortCut(_loc_4, int(_loc_10["t"]), _loc_10["v"]);
                    cache.shortcut.removeShortcut(_loc_9);
                    this._shortcutBar.updateShortcutSource(_loc_4, _loc_5);
                    this._shortcutBar.updateShortcutSource(_loc_9, null);
                }
                else
                {
                    cache.shortcut.addShortCut(_loc_4, int(_loc_10["t"]), _loc_10["v"]);
                    cache.shortcut.addShortCut(_loc_9, int(_loc_7["t"]), _loc_7["v"]);
                    this._shortcutBar.updateShortcutSource(_loc_9, _loc_6);
                    this._shortcutBar.updateShortcutSource(_loc_4, _loc_5);
                }
            }
            else
            {
                _loc_8 = CDDataType.parseType(_loc_5);
                _loc_11 = ShortcutBarUtil.parseValue(_loc_5);
                cache.shortcut.addShortCut(_loc_4, _loc_8, _loc_11);
                this._shortcutBar.updateShortcutSource(_loc_4, _loc_5);
            }
            cache.shortcut.save();
            return;
        }// end function

        private function exShortcutBarMoveIn(event:DataEvent) : void
        {
            var _loc_10:int = 0;
            var _loc_11:Object = null;
            var _loc_12:Object = null;
            var _loc_2:* = event.data["from"];
            var _loc_3:* = event.data["to"];
            var _loc_4:* = cache.pet.fightPetUid;
            if (_loc_3 == null || _loc_2 == null)
            {
                return;
            }
            var _loc_5:* = _loc_3.pos;
            var _loc_6:* = _loc_2.dragSource;
            var _loc_7:* = _loc_3.dragSource;
            var _loc_8:* = cache.exSkillShortcut.getData(_loc_4, _loc_5);
            var _loc_9:* = CDDataType.skillInfo;
            if (_loc_2 is ShortcutBarItem)
            {
                _loc_10 = ShortcutBarItem(_loc_2).pos;
                _loc_11 = cache.exSkillShortcut.getData(_loc_4, _loc_10);
                if (_loc_8 == null)
                {
                    cache.exSkillShortcut.addShortCut(_loc_4, _loc_5, int(_loc_11["t"]), _loc_11["v"]);
                    cache.exSkillShortcut.removeShortcut(_loc_4, _loc_10);
                    this._exSkillBar.updateShortcutSource(_loc_5, _loc_6);
                    this._exSkillBar.updateShortcutSource(_loc_10, null);
                }
                else
                {
                    cache.exSkillShortcut.addShortCut(_loc_4, _loc_5, int(_loc_11["t"]), _loc_11["v"]);
                    cache.exSkillShortcut.addShortCut(_loc_4, _loc_10, int(_loc_8["t"]), _loc_8["v"]);
                    this._exSkillBar.updateShortcutSource(_loc_10, _loc_7);
                    this._exSkillBar.updateShortcutSource(_loc_5, _loc_6);
                }
            }
            else
            {
                _loc_9 = CDDataType.parseType(_loc_6);
                _loc_12 = ShortcutBarUtil.parseValue(_loc_6);
                cache.exSkillShortcut.addShortCut(_loc_4, _loc_5, _loc_9, _loc_12);
                this._exSkillBar.updateShortcutSource(_loc_5, _loc_6);
            }
            cache.exSkillShortcut.save();
            return;
        }// end function

        private function throwHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as ShortcutBarItem;
            var _loc_3:* = _loc_2.pos;
            cache.shortcut.removeShortcut(_loc_3);
            this._shortcutBar.updateShortcutSource(_loc_3, null);
            cache.shortcut.save();
            return;
        }// end function

        private function uiRowInitedHandler(event:DataEvent) : void
        {
            var _loc_2:String = this;
            var _loc_3:* = this._msgGot + 1;
            _loc_2._msgGot = _loc_3;
            cache.skill.initAllBasicSkills();
            GameController.cd.registerBasicSkillCD();
            if (this._msgGot >= 2)
            {
                this.checkAndShowShortcutBarIcon();
            }
            if (GameController.autoGuide.hasGuideWizard)
            {
                Dispatcher.removeEventListener(EventName.AutoGuideActiveByEvent, this.spriteUpdate);
                this._shortcutBar.thawFrzzing();
            }
            return;
        }// end function

        private function shortcutDataUpdateHandler(param1:Object) : void
        {
            var _loc_2:String = this;
            var _loc_3:* = this._msgGot + 1;
            _loc_2._msgGot = _loc_3;
            if (this._msgGot >= 2)
            {
                this.checkAndShowShortcutBarIcon();
            }
            return;
        }// end function

        private function checkAndShowShortcutBarIcon() : void
        {
            var _loc_2:String = null;
            var _loc_3:Object = null;
            var _loc_4:int = 0;
            var _loc_5:int = 0;
            var _loc_6:int = 0;
            var _loc_7:Object = null;
            var _loc_1:* = cache.shortcut.shortcutBarDatas;
            for (_loc_2 in _loc_1)
            {
                
                _loc_3 = _loc_1[_loc_2];
                _loc_4 = int(_loc_3["t"]);
                _loc_5 = int(_loc_3["v"]);
                _loc_6 = int(_loc_2);
                _loc_7 = ShortcutBarUtil.getSource(_loc_3, _loc_6);
                if (_loc_7 == null)
                {
                    continue;
                }
                this._shortcutBar.updateShortcutSource(_loc_6, _loc_7);
            }
            CallLater.addCallBack(this.nextFrameShortcutDataGot);
            if (SystemSetting.instance.isInitedFromServer)
            {
                this.updateLockStatus();
                this.updateShowCDTime();
            }
            return;
        }// end function

        private function onExSkillShortcutBarDataUpdate(param1:Object) : void
        {
            var _loc_5:String = null;
            var _loc_6:SkillInfo = null;
            var _loc_7:Array = null;
            var _loc_8:Object = null;
            var _loc_9:int = 0;
            var _loc_10:int = 0;
            var _loc_11:Object = null;
            var _loc_12:int = 0;
            var _loc_13:Object = null;
            if (!this._exSkillBar)
            {
                return;
            }
            var _loc_2:* = cache.exSkillShortcut.shortcutBarDatas;
            var _loc_3:* = cache.pet.fightPetUid;
            var _loc_4:Array = [];
            for (_loc_5 in _loc_2)
            {
                
                _loc_7 = _loc_5.split("_");
                if (_loc_7[0] == _loc_3)
                {
                    _loc_8 = _loc_2[_loc_5];
                    _loc_9 = int(_loc_8["v"]);
                    _loc_10 = int(_loc_7[1]);
                    _loc_11 = cache.skill.getSkillBySerialId(_loc_9);
                    if (_loc_11)
                    {
                        this._exSkillBar.updateShortcutSource(_loc_10, _loc_11);
                        _loc_4.push(_loc_9);
                    }
                }
            }
            for each (_loc_6 in cache.skill.getExSkillList())
            {
                
                _loc_12 = 1;
                while (_loc_12 <= GameConst.PetBreakCopyMaxSkill)
                {
                    
                    _loc_13 = cache.exSkillShortcut.getData(_loc_3, _loc_12);
                    if (_loc_13 == null && _loc_4.indexOf(_loc_6.tSkill.series) == -1)
                    {
                        _loc_4.push(_loc_6.tSkill.series);
                        cache.exSkillShortcut.addShortCut(_loc_3, _loc_12, CDDataType.skillInfo, _loc_6.tSkill.series);
                        cache.exSkillShortcut.save();
                        break;
                    }
                    _loc_12++;
                }
            }
            return;
        }// end function

        private function nextFrameShortcutDataGot() : void
        {
            var _loc_2:int = 0;
            var _loc_3:SkillInfo = null;
            var _loc_4:int = 0;
            var _loc_5:Object = null;
            var _loc_1:* = !ClientSetting.local.getIsDone(IsDoneType.IsFirstTimeInGame);
            if (_loc_1)
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.Guide_FirstTimeInGame));
                _loc_2 = 1;
                while (_loc_2 < 3)
                {
                    
                    _loc_3 = cache.skill.getSkillByPosType(_loc_2, false);
                    if (!_loc_3)
                    {
                    }
                    else
                    {
                        _loc_4 = CDDataType.parseType(_loc_3);
                        _loc_5 = ShortcutBarUtil.parseValue(_loc_3);
                        cache.shortcut.addShortCut(_loc_2, _loc_4, _loc_5);
                        this._shortcutBar.updateShortcutSource(_loc_2, _loc_3);
                    }
                    _loc_2++;
                }
                cache.shortcut.save();
                ClientSetting.local.setIsDone(true, IsDoneType.IsFirstTimeInGame);
            }
            this._shortcutBar.updateItemsShow(false);
            return;
        }// end function

        private function shorcutKeyUpdateHandler(event:DataEvent) : void
        {
            var _loc_2:* = event.data as Array;
            if (this._shortcutBar == null)
            {
            }
            this._shortcutBar.updateShortcutKey(_loc_2);
            if (this._exSkillBar != null && this._exSkillBar.visible == true)
            {
                this._exSkillBar.updateShortcutKey(_loc_2);
            }
            return;
        }// end function

        private function shortcutBarDataChangeHandler(event:DataEvent) : void
        {
            var _loc_6:Object = null;
            var _loc_2:* = event.data;
            var _loc_3:* = int(_loc_2["pos"]);
            var _loc_4:* = int(_loc_2["t"]);
            var _loc_5:* = int(_loc_2["v"]);
            if (_loc_4 == CDDataType.skillInfo)
            {
                _loc_6 = cache.skill.getSkill(_loc_5);
            }
            else if (_loc_4 == CDDataType.itemData)
            {
                _loc_6 = ItemConfig.instance.getConfig(_loc_5);
            }
            if (_loc_6 != null)
            {
                this._shortcutBar.updateShortcutSource(_loc_3, _loc_6);
            }
            return;
        }// end function

        private function onShortExCutBarDataChange(event:DataEvent) : void
        {
            var _loc_6:Object = null;
            var _loc_2:* = event.data;
            var _loc_3:* = int(_loc_2["pos"]);
            var _loc_4:* = int(_loc_2["t"]);
            var _loc_5:* = int(_loc_2["v"]);
            if (_loc_4 == CDDataType.skillInfo)
            {
                _loc_6 = cache.skill.getSkillBySerialId(_loc_5);
            }
            if (_loc_6 != null)
            {
                this._exSkillBar.updateShortcutSource(_loc_3, _loc_6);
            }
            return;
        }// end function

        private function keyUpHandler(event:DataEvent) : void
        {
            cache.shortcut.lastKeyDownPos = -1;
            var _loc_2:* = int(event.data);
            this._keyProcessor.delKeyDown(_loc_2);
            return;
        }// end function

        private function keyDownHandler(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data);
            if (!this.checkAndUsePos(_loc_2))
            {
                return;
            }
            cache.shortcut.lastKeyDownPos = _loc_2;
            cache.shortcut.isLastKeyByClick = false;
            this._keyProcessor.addKeyDown(_loc_2);
            return;
        }// end function

        private function clickHandler(event:DataEvent) : void
        {
            var _loc_2:* = int(event.data);
            if (!this.checkAndUsePos(_loc_2))
            {
                return;
            }
            cache.shortcut.lastKeyDownPos = _loc_2;
            cache.shortcut.isLastKeyByClick = true;
            this._keyProcessor.checkAndUseKey(_loc_2, true, true);
            return;
        }// end function

        private function checkAndUsePos(param1:int) : Boolean
        {
            var _loc_2:* = this._shortcutBar.getDragSource(param1);
            if (_loc_2 != null && _loc_2 is SkillInfo)
            {
                if (!FightUtil.isCanAttackPlayer(true))
                {
                    return false;
                }
            }
            return true;
        }// end function

        private function tabKeyChangeTargetHandler(event:DataEvent) : void
        {
            TabKeyAI.instance.work();
            return;
        }// end function

        private function updateAnger(param1:Object) : void
        {
            this._shortcutBar.updateAnger();
            return;
        }// end function

        private function updateSelected(param1:Object) : void
        {
            this._shortcutBar.updateSelected();
            return;
        }// end function

        private function updateExp(param1:Object) : void
        {
            this._shortcutBar.updateExp(param1 as int);
            return;
        }// end function

        private function updateExpBgLevel(param1:Object) : void
        {
            this._shortcutBar.updateExpBgLevel();
            return;
        }// end function

        private function updateWorldLevel(param1:Object) : void
        {
            this._shortcutBar.updateExpTxt();
            return;
        }// end function

        public function get keyProcessor() : ShortcutBarKeyProcessor
        {
            return this._keyProcessor;
        }// end function

        public function get shortcutBar() : ShortcutBar
        {
            return this._shortcutBar;
        }// end function

        public function get exSkillBar() : ExSkillShortcutBar
        {
            return this._exSkillBar;
        }// end function

        public function spriteUpdate(event:DataEvent) : void
        {
            if (event.data["mainId"] == 8)
            {
                Dispatcher.removeEventListener(EventName.AutoGuideActiveByEvent, this.spriteUpdate);
                this._shortcutBar.thawFrzzing();
            }
            return;
        }// end function

    }
}
